﻿<?php

/**
 * @author Nguyen Xuan Hong
 * @copyright 2010
 */
require_once("includes/video.tbl.php");
$branch_id = $_REQUEST["branch"];

$pClsVideo = new clsVideoTable();
$listvideo = $pClsVideo->listobj($branch_id);



?>
<script language="javascript">
	function playvideo(url){
		$('#index-videoplayer').attr('src','flvplayer.swf?autostart=true&repeat=always&file='+url+'');
	}
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="auto" height="30" class="header14" align="center">
											Video của bé
										</td>
									</tr>
									<tr>
										<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
										</td>
									</tr>
									<tr>
										<td width="auto" class="content" align="center">
											<embed id="index-videoplayer" width="600" allowfullscreen="true" height="450" src="flvplayer.swf?autostart=true&repeat=always&file=&filename=mediaplayer" name="player"/>
										</td>
									</tr>
									<?
									if(count($listvideo))
									{
									?>
	<tr>
	<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
	</td>
	</tr>
	<tr>
	<td height="5">
	</td>
	</tr>
	<tr>
	<td height="20" width="auto" class="header12">
											<? echo($link); ?>
</td>
</tr>
<tr>
<td>
											<?
											$count = count($listvideo);
											if($count)
											{
												$col = 4;
												$row = ($count / $col) + 1;
												$k = 1;
											?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
														<?
														for( $i = 1; $i <= $row; $i++)
														{
														?>
	<tr>
																<?
																for($j = 1; $j <= $col; $j++)
																{
																	if($k==1)
																		$pClsVideo = current($listvideo);
																	else
																		$pClsVideo = next($listvideo);
																	$k++;
																?>
<td width="120" align="center">
																		<? 
																		if($pClsVideo)
																		{
																		?>
																				<a title="<? echo($pClsVideo->value('title'));?>" onclick="playvideo('<? echo($pClsVideo->value('url')); ?>')" href="#indexvideo,1">
																					<img src="<? echo($pClsVideo->value('image')); ?>" width="95px" height="65px">
																					<div><? echo($pClsVideo->value('title'));?></div>
</a>
																				<? 
																			}
																			?>
</td>
																	<?	
																}
																?>
</tr>
																<?
															} 
															?>
</table>
													<?
												}
												?>
</td>
</tr>
									<?
								}
								?>
								</table>